class Vector:
    def __init__(self, *components):      # 1. 可变位置参数
        self.data = list(components)

    @staticmethod
    def dot(a, b):                        # 2. 静态方法
        return sum(x*y for x, y in zip(a.data, b.data))

    @property
    def length(self):                     # 3. property
        return sum(x*x for x in self.data) ** 0.5

    def __lt__(self, other):              # 4. 魔术方法
        return self.length < other.length

    def __repr__(self):
        return f"Vector{tuple(self.data)}"

v1 = Vector(1, 2)
v2 = Vector(3, 4)
print(Vector.dot(v1, v2))   # 静态方法算点积：11
print(v1.length)            # 0 括号拿长度：2.236
print(sorted([v2, v1]))     # 按 length 排序：[Vector(1, 2), Vector(3, 4)]
